package com.laicunba.util;

public class AndroidUtil {
	/**
	 * 解析Apk名字,返回名字中各数据函意
	 * 
	 * @param apkName
	 * @return ["渠道号","VersionCode","VersionName"]
	 */
	public static String[] splitApkName(String apkName) {
		if (!apkName.matches("[a-z0-9_]+_[0-9]+_[0-9.]+\\.apk")) {
			return new String[] { "0", "0", "0" };
		}
		apkName = apkName.substring(0, apkName.length() - 4);
		String names[] = new String[3];
		names[2] = apkName.substring(apkName.lastIndexOf("_")+1, apkName.length());
		apkName = apkName.substring(0, apkName.lastIndexOf("_"));
		names[1] = apkName.substring(apkName.lastIndexOf("_")+1, apkName.length());
		names[0] = apkName.substring(0, apkName.lastIndexOf("_"));

		return names;
	}

}
